<template>
	<view class="memo-bg">
		<view class="top-gradient"></view>
		<view class="memo-card">
			<view class="memo-input memo-margin-b">
				<input type="text" placeholder="周计划" v-model="form.planTitle" />
			</view>
			<view class="memo-input">
				<input type="text" placeholder="每周日" v-model="form.planTime" />
			</view>
		</view>
		<view class="memo-btn">
			<button class="save-btn" type="primary" @click="submit">添加</button>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				form: {
					planTitle: "",
					planTime: "",
					createTime: new Date().getTime()
				}
			}
		},
		methods: {
			submit() {
				if (!this.form.planTitle) {
					uni.showToast({
						title: '请输入周计划',
						icon: 'none',
						duration: 2000
					});
					return;
				}
				if (!this.form.planTime) {
					uni.showToast({
						title: '请输入时间',
						icon: 'none',
						duration: 2000
					});
					return;
				}
				console.log("--------------执行添加备忘录操作--------------");
				uniCloud.callFunction({
					name: 'addBeiwanglu',
					data: this.form,
					success: (e) => {
						console.log(e.result);
						uni.showToast({
							title: '添加成功',
							duration: 2000
						});
						uni.navigateTo({
							url: "../list/list"
						})
					},
					fail: (err) => {
						console.error('添加失败', err);
						uni.showToast({
							title: '添加失败',
							icon: 'none',
							duration: 2000
						});
					}
				})
			}
		}
	}
</script>

<style>
	.landing {
		height: 84upx;
		line-height: 84upx;
		border-radius: 44upx;
		font-size: 32upx;
		background: linear-gradient(left, #FF978D, #FFBB69);
	}

	.forget-btn {
		padding: 10upx 20upx;
		margin-top: 580upx;
	}

	.forget-input input {
		background: #F2F5F6;
		font-size: 28upx;
		padding: 10upx 25upx;
		height: 62upx;
		line-height: 62upx;
		border-radius: 8upx;
	}

	.forget-margin-b {
		margin-bottom: 25upx;
	}

	.forget-input {
		padding: 10upx 20upx;
		overflow: auto;
	}

	.forget-card {
		background: #fff;
		border-radius: 12upx;
		padding: 60upx 25upx;
		box-shadow: 0 6upx 18upx rgba(0, 0, 0, 0.12);
		position: relative;
		margin-top: 120upx;
	}

	.forget-bg {
		height: 260upx;
		padding: 25upx;
		background: linear-gradient(#FF978D, #FFBB69);
	}
</style>